package com.yfyszk.kingbird.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfyszk.kingbird.common.utils.PageInfo;
import com.yfyszk.kingbird.common.utils.PageUtils;
import com.yfyszk.kingbird.entity.MemberEntity;
import com.yfyszk.kingbird.exception.GlobalServiceException;
import com.yfyszk.kingbird.feign.OrderFeignClient;
import com.yfyszk.kingbird.mapper.MemberMapper;
import com.yfyszk.kingbird.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("memberService")
public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberEntity> implements IMemberService {
    @Autowired
    private OrderFeignClient orderFeignClient;
    @Override
    public String getUserOrder(String orderId) {
       /* if(1==1){
            throw  new  GlobalServiceException(1,"请求参数有误");
        }*/
        String order = orderFeignClient.getOrder(orderId);
        return order;
    }
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        return null;
    }

    @Override
    public PageUtils listzdyPage(PageInfo pageInfo) {
        Page<MemberEntity> page = new Page<MemberEntity>(pageInfo.getCurrent(), pageInfo.getLimit());
        IPage<MemberEntity> all = this.baseMapper.listzdyPage(page);
        /*if(1==1){
            throw new GlobalServiceException(1,"参数异常");
        }*/
        return new PageUtils(all);
    }
}